-- Meta class
Rectangle = {area = 0, length = 0, breadth = 0}

-- 派生类的方法 new
function Rectangle:new(o,length,breadth)
  o = o or {}
  print(self, o, length, breadth)
  setmetatable(o, self)
  self.__index = self
  self.length = length or 0
  self.breadth = breadth or 0
  self.area = length*breadth;
  return o
end

-- 派生类的方法 printArea
function Rectangle:printArea()
  print(slef)
  print("矩形面积为 ", self.area)
end

r = Rectangle:new(nil, 15, 20)
r:printArea()

r2 = Rectangle:new(nil, 200, 300)
print("-----------------------")
for k, v in pairs(Rectangle) do
    print(k, v)
end
